.class public Lweibo4android/util/BareBonesBrowserLaunch;
.super Ljava/lang/Object;
.source "BareBonesBrowserLaunch.java"


# direct methods
.method public constructor <init>()V
    .locals 0

    .prologue
    .line 22
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method

.method private static browse(Ljava/lang/String;)V
    .locals 12
    .parameter "url"
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/lang/ClassNotFoundException;,
            Ljava/lang/IllegalAccessException;,
            Ljava/lang/IllegalArgumentException;,
            Ljava/lang/InterruptedException;,
            Ljava/lang/reflect/InvocationTargetException;,
            Ljava/io/IOException;,
            Ljava/lang/NoSuchMethodException;
        }
    .end annotation

    .prologue
    const/4 v11, 0x2

    const/4 v10, 0x1

    const/4 v9, 0x0

    .line 35
    const-string v6, "os.name"

    const-string v7, ""

    invoke-static {v6, v7}, Ljava/lang/System;->getProperty(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v5

    .line 36
    .local v5, osName:Ljava/lang/String;
    const-string v6, "Mac OS"

    invoke-virtual {v5, v6}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z

    move-result v6

    if-eqz v6, :cond_0

    .line 37
    const-string v6, "com.apple.eio.FileManager"

    invoke-static {v6}, Ljava/lang/Class;->forName(Ljava/lang/String;)Ljava/lang/Class;

    move-result-object v3

    .line 38
    .local v3, fileMgr:Ljava/lang/Class;
    const-string v6, "openURL"

    new-array v7, v10, [Ljava/lang/Class;

    const-class v8, Ljava/lang/String;

    aput-object v8, v7, v9

    invoke-virtual {v3, v6, v7}, Ljava/lang/Class;->getDeclaredMethod(Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method;

    move-result-object v4

    .line 39
    .local v4, openURL:Ljava/lang/reflect/Method;
    const/4 v6, 0x0

    new-array v7, v10, [Ljava/lang/Object;

    aput-object p0, v7, v9

    invoke-virtual {v4, v6, v7}, Ljava/lang/reflect/Method;->invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;

    .line 53
    .end local v3           #fileMgr:Ljava/lang/Class;
    .end local v4           #openURL:Ljava/lang/reflect/Method;
    :goto_0
    return-void

    .line 40
    :cond_0
    const-string v6, "Windows"

    invoke-virtual {v5, v6}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z

    move-result v6

    if-eqz v6, :cond_1

    .line 41
    invoke-static {}, Ljava/lang/Runtime;->getRuntime()Ljava/lang/Runtime;

    move-result-object v6

    new-instance v7, Ljava/lang/StringBuilder;

    const-string v8, "rundll32 url.dll,FileProtocolHandler "

    invoke-direct {v7, v8}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v7, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v7

    invoke-virtual {v7}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v7

    invoke-virtual {v6, v7}, Ljava/lang/Runtime;->exec(Ljava/lang/String;)Ljava/lang/Process;

    goto :goto_0

    .line 43
    :cond_1
    const/4 v6, 0x6

    new-array v1, v6, [Ljava/lang/String;

    const-string v6, "firefox"

    aput-object v6, v1, v9

    const-string v6, "opera"

    aput-object v6, v1, v10

    const-string v6, "konqueror"

    aput-object v6, v1, v11

    const/4 v6, 0x3

    const-string v7, "epiphany"

    aput-object v7, v1, v6

    const/4 v6, 0x4

    const-string v7, "mozilla"

    aput-object v7, v1, v6

    const/4 v6, 0x5

    const-string v7, "netscape"

    aput-object v7, v1, v6

    .line 44
    .local v1, browsers:[Ljava/lang/String;
    const/4 v0, 0x0

    .line 45
    .local v0, browser:Ljava/lang/String;
    const/4 v2, 0x0

    .local v2, count:I
    :goto_1
    array-length v6, v1

    if-ge v2, v6, :cond_2

    if-eqz v0, :cond_3

    .line 48
    :cond_2
    if-nez v0, :cond_5

    .line 49
    new-instance v6, Ljava/lang/NoSuchMethodException;

    const-string v7, "Could not find web browser"

    invoke-direct {v6, v7}, Ljava/lang/NoSuchMethodException;-><init>(Ljava/lang/String;)V

    throw v6

    .line 46
    :cond_3
    invoke-static {}, Ljava/lang/Runtime;->getRuntime()Ljava/lang/Runtime;

    move-result-object v6

    new-array v7, v11, [Ljava/lang/String;

    const-string v8, "which"

    aput-object v8, v7, v9

    aget-object v8, v1, v2

    aput-object v8, v7, v10

    invoke-virtual {v6, v7}, Ljava/lang/Runtime;->exec([Ljava/lang/String;)Ljava/lang/Process;

    move-result-object v6

    invoke-virtual {v6}, Ljava/lang/Process;->waitFor()I

    move-result v6

    if-nez v6, :cond_4

    .line 47
    aget-object v0, v1, v2

    .line 45
    :cond_4
    add-int/lit8 v2, v2, 0x1

    goto :goto_1

    .line 51
    :cond_5
    invoke-static {}, Ljava/lang/Runtime;->getRuntime()Ljava/lang/Runtime;

    move-result-object v6

    new-array v7, v11, [Ljava/lang/String;

    aput-object v0, v7, v9

    aput-object p0, v7, v10

    invoke-virtual {v6, v7}, Ljava/lang/Runtime;->exec([Ljava/lang/String;)Ljava/lang/Process;

    goto :goto_0
.end method

.method public static openURL(Ljava/lang/String;)V
    .locals 1
    .parameter "url"

    .prologue
    .line 26
    :try_start_0
    invoke-static {p0}, Lweibo4android/util/BareBonesBrowserLaunch;->browse(Ljava/lang/String;)V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    .line 30
    :goto_0
    return-void

    .line 27
    :catch_0
    move-exception v0

    goto :goto_0
.end method
